﻿using ArithCollect;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Test.Scenes {
    public partial class WcfProxyImplement : UserControl {
        public WcfProxyImplement() {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e) {
            Acex.ServiceImplement(
                (m) => { m .Item1= "Welcome"; ProxyService1.Deputy.Welcome(); },
                (o) => { tbr.Text = o.ToString(); },
                isOrder:true,
                error: (ex) => { tbr.Text = ex.Message; }
                );
            //welcome
        }

        private void Button_Click_1(object sender, RoutedEventArgs e) {
            var a = int.Parse(tbleft.Text);
            var b = int.Parse(tbright.Text);
            Acex.ServiceImplement(
                (m) => { m.Item1 = "Add"; ProxyService1.Deputy.Add(a,b); },
                (o) => { tbr.Text = o.ToString(); },
                false,
                error: (ex) => { tbr.Text = ex.Message; }
                );
            //+
        }

        private void Button_Click_2(object sender, RoutedEventArgs e) {
            var a = int.Parse(tbleft.Text);
            var b = int.Parse(tbright.Text);
            Acex.ServiceImplement(
                (m) => { m.Item1 = "Subtract"; ProxyService1.Deputy.Subtract(a, b); },
                (o) => { tbr.Text = o.ToString(); },
                false,
                error: (ex) => { tbr.Text = ex.Message; }
                );
        }

        private void Button_Click_3(object sender, RoutedEventArgs e) {
            var a = int.Parse(tbleft.Text);
            var b = int.Parse(tbright.Text);
            Acex.ServiceImplement(
                m => { m.Item1 = "Multiply"; ProxyService1.Deputy.Multiply(a, b); },
                o => { tbr.Text = o.ToString(); },
                true,
                error: (ex) => { tbr.Text = ex.Message; }
                );
        }

        private void Button_Click_4(object sender, RoutedEventArgs e) {
            var a = int.Parse(tbleft.Text);
            var b = int.Parse(tbright.Text);
            Acex.ServiceImplement(
                (m) => { m.Item1 = "Division"; ProxyService1.Deputy.Division(a, b); },
                (o) => { tbr.Text = o.ToString(); },
                false,
                error: (ex) => { tbr.Text = ex.Message; }
                );
        }
    }
}
